import 'package:flutter_test/flutter_test.dart';
import 'package:plugin_java/plugin_java.dart';
import 'package:plugin_java/plugin_java_platform_interface.dart';
import 'package:plugin_java/plugin_java_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockPluginJavaPlatform
    with MockPlatformInterfaceMixin
    implements PluginJavaPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final PluginJavaPlatform initialPlatform = PluginJavaPlatform.instance;

  test('$MethodChannelPluginJava is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelPluginJava>());
  });

  test('getPlatformVersion', () async {
    PluginJava pluginJavaPlugin = PluginJava();
    MockPluginJavaPlatform fakePlatform = MockPluginJavaPlatform();
    PluginJavaPlatform.instance = fakePlatform;

    expect(await pluginJavaPlugin.getPlatformVersion(), '42');
  });
}
